﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using LibNiconico.NiconicoApi.Utils;

namespace NiconicoApiHelperUnitTest
{

    [TestFixture]
    class ApiResultCodeTest
    {

        [TestCase("closed",NicoErrorCode.Closed)]
        [TestCase("notlogin",NicoErrorCode.NotLogin)]
        [TestCase("invalid_thread",NicoErrorCode.InvalidThread)]
        [TestCase("invalid_v1",NicoErrorCode.InvalidV1)]
        [TestCase("unknown_error",NicoErrorCode.UnknownError)]
        [TestCase("unknown",NicoErrorCode.Unknown)]
        [TestCase("maintenance",NicoErrorCode.Maintenance)]
        [TestCase("deleted",NicoErrorCode.Deleted)]
        [TestCase("DELETED", NicoErrorCode.Deleted)]
        [TestCase("full",NicoErrorCode.Full)]
        [TestCase("permission_denied",NicoErrorCode.PermissionDenied)]
        [TestCase("not_permitted",NicoErrorCode.NotPermitted)]
        [TestCase("require_community_member",NicoErrorCode.RequireCommunityMember)]
        [TestCase("access_locked",NicoErrorCode.AccessLocked)]
        [TestCase("comingsoon",NicoErrorCode.ComingSoon)]
        [TestCase("require_accept_print_timeshift_ticket", NicoErrorCode.RequireAcceptPrintTimeShiftTicket)]
        [TestCase("tsarchive",NicoErrorCode.TSArchive)]
        [TestCase("usertimeshift",NicoErrorCode.UserTimeShift)]
        [TestCase("未定義コード",NicoErrorCode.Undefined)]
        public void ResultCodeTeset(string code, NicoErrorCode expect)
        {
            var result = NicoApiError.CreateFromResultCode(code);

            Assert.AreEqual(result.Code, expect);
            Assert.AreEqual(result.GetBaseCode(), code);
        }
    }
}
